﻿
using System;
using System.Collections;

namespace Xacml.Core.Context
{
  public class ResourceCollection : ResourceCollectionReadWrite
  {
    public override ResourceElementReadWrite this[int index]
    {
      get
      {
        return (ResourceElementReadWrite) this.List[index];
      }
      set
      {
        throw new NotSupportedException();
      }
    }

    public ResourceCollection()
    {
    }

    public ResourceCollection(ResourceCollectionReadWrite items)
    {
      foreach (ResourceElementReadWrite elementReadWrite in (CollectionBase) items)
        this.Add(elementReadWrite);
    }

    public override int Add(ResourceElementReadWrite value)
    {
      ResourceContentElement resourceContent = (ResourceContentElement) null;
      if (value.ResourceContent != null)
        resourceContent = new ResourceContentElement(value.ResourceContent.XmlDocument, value.ResourceContent.SchemaVersion);
      return this.List.Add((object) new ResourceElement(resourceContent, value.ResourceScopeValue, new AttributeCollection(value.Attributes), value.SchemaVersion));
    }

    public override void Clear()
    {
      throw new NotSupportedException();
    }

    public override void RemoveAt(int index)
    {
      throw new NotSupportedException();
    }
  }
}
